home *** CD-ROM | disk | FTP | other *** search
-
-
-
- MV - Move or Rename Files/Sub-directories
- Version 1.01 - March 26, 1985
- For PC-DOS Versions 2.0 and Above
-
-
-
- (C) Copyright 1985 Harry G. McGavran, Jr.
- All Rights Reserved
-
- PERMISSION TO USE, COPY, MODIFY, AND DISTRIBUTE THIS PROGRAM AND
- ITS DOCUMENTATION FOR ANY PURPOSE AND WITHOUT FEE IS HEREBY
- GRANTED, PROVIDED THAT THE COPYRIGHT NOTICE, THIS NOTICE, AND THE
- DISCLAIMER OF WARRANTY NOTICE APPEAR ON ALL COPIES AND SUPPORTING
- DOCUMENTATION.
-
-
-
- DISCLAIMER OF WARRANTY
-
- THE AUTHOR MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THIS
- SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS PROVIDED "AS IS"
- WITHOUT EXPRESS OR IMPLIED WARRANTY. THE USER IS ADVISED TO TEST
- THE PROGRAM THOROUGHLY BEFORE RELYING ON IT. THE USER MUST AS-
- SUME THE ENTIRE RISK OF USING THE PROGRAM. NO LIABILITY FOR THE
- USE OF THIS PROGRAM IN ANY FORM IS ASSUMED BY THE AUTHOR.
-
-
-
- The PC-DOS "rename" command performs a function similar to "mv"
- except that "rename" does not work with sub-directory names.
- "Mv" also will allow moving a branch of a directory from one
- place to another.
-
- "Mv" is invoked with the command line:
-
- mv from_path to_path
-
- "Mv" moves (changes the name of) the node specified by
- "from_path" to the node specified by "to_path" in the style of
- the UNIX "mv".
-
- If "to_path" specifies an existing FILE name, then the move will
- not be performed.
-
- If "to_path" specifies an existing DIRECTORY name instead of a
- FILE name, then the node specified by "from_path" is moved into
- that directory. If the node specified by "from_path" already ex-
- ists in the directory specified by "to_path", then the move will
- not be performed. If the directory specified by "to_path" is a
- sub-directory and has no free directory slots available, then the
- move will not be performed even though another cluster could be
- added to the sub-directory to make more free slots.
-
- If "to_path" specifies an existing DIRECTORY name, then
- "from_path" may be specified with wildcards. If "to_path" speci-
- fies a FILE name and the file does not exist, and "from_path" is
- specified with wildcards, only the first matching file found will
- be moved.
-
- "To_path" may not be specified with wildcards.
-
-
-
-
-
-
- "Mv" works by modifying the directory entries. "Mv" does not
- copy any data. This means that "mv" will work only within one
- disk. Because PC-DOS versions 3.0 and above provide no system
- services for directly reading and modifying file cluster pointers
- in directories (see note below), it also means that renaming a
- file with "mv" requires more time than the PC-DOS "rename" com-
- mand. "Mv" must perform functions similar to the PC-DOS "chkdsk"
- command and requires about the same amount of time as "chkdsk"
- does to run. If wildcards are specified and "n" matches are
- found, then "mv" requires about the same time as running "chkdsk"
- "n" times. But renaming or moving an entire sub-directory re-
- quires considerably less time than copying the contents, which
- was the only alternative using the PC-DOS commands.
-
- Since "mv" was written based upon data structures that IBM has
- indicated may change in future releases of PC-DOS, to date "mv"
- has been verified only with PC-DOS versions 2.0, 2.1, and 3.0.
-
- If you find this program useful, and wish to make a small contri-
- bution to its author, he may be reached by mail at:
-
- Harry G. McGavran, Jr.
- 2506 35th St.
- Los Alamos
- New Mexico 87544
-
- Trademarks:
- IBM is a trademark of International Business Machines, Inc.
- PC-DOS is a trademark of I.B.M.
- UNIX is a trademark of Bell Laboratories
-
- Note:
- There is an article on one method of reading and writing file
- cluster pointers in sub-directories in the February 1985 issue
- of "PC TECH JOURNAL", page 67, by Ted Mirecki. He does not
- address root directories, but the techniques are similar. I
- tried his technique on PC-DOS versions 2.0, 2.1, and 3.0. I
- found them to work on versions 2.0 and 2.1, but I was not able
- to get them to work on version 3.0. What Ted Mirecki suggests
- is a special method of opening a sub-directory as a file,
- which then allows the use of the PC-DOS file input/output sys-
- tem calls for modification of the sub-directory. What I had
- to do instead is direct disk access input/output by tracing
- the sub-directory through the File Allocation Table, since I
- could not treat a sub-directory as a file for output under
- PC-DOS version 3.0.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-